3.1.88 \(\int (a+b \cot (c+d x))^n \, dx\) [88]

Optimal. Leaf size=167 \[ -\frac {b (a+b \cot (c+d x))^{1+n} \, _2F_1\left (1,1+n;2+n;\frac {a+b \cot (c+d x)}{a-\sqrt {-b^2}}\right )}{2 \sqrt {-b^2} \left (a-\sqrt {-b^2}\right ) d (1+n)}+\frac {b (a+b \cot (c+d x))^{1+n} \, _2F_1\left (1,1+n;2+n;\frac {a+b \cot (c+d x)}{a+\sqrt {-b^2}}\right )}{2 \sqrt {-b^2} \left (a+\sqrt {-b^2}\right ) d (1+n)} \]

[Out]

-1/2*b*(a+b*cot(d*x+c))^(1+n)*hypergeom([1, 1+n],[2+n],(a+b*cot(d*x+c))/(a-(-b^2)^(1/2)))/d/(1+n)/(a-(-b^2)^(1
/2))/(-b^2)^(1/2)+1/2*b*(a+b*cot(d*x+c))^(1+n)*hypergeom([1, 1+n],[2+n],(a+b*cot(d*x+c))/(a+(-b^2)^(1/2)))/d/(
1+n)/(-b^2)^(1/2)/(a+(-b^2)^(1/2))

________________________________________________________________________________________

Rubi [A]
time = 0.18, antiderivative size = 167, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 3, integrand size = 12, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.250, Rules used = {3566, 726, 70} \begin {gather*} \frac {b (a+b \cot (c+d x))^{n+1} \, _2F_1\left (1,n+1;n+2;\frac {a+b \cot (c+d x)}{a+\sqrt {-b^2}}\right )}{2 \sqrt {-b^2} d (n+1) \left (a+\sqrt {-b^2}\right )}-\frac {b (a+b \cot (c+d x))^{n+1} \, _2F_1\left (1,n+1;n+2;\frac {a+b \cot (c+d x)}{a-\sqrt {-b^2}}\right )}{2 \sqrt {-b^2} d (n+1) \left (a-\sqrt {-b^2}\right )} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(a + b*Cot[c + d*x])^n,x]

[Out]

-1/2*(b*(a + b*Cot[c + d*x])^(1 + n)*Hypergeometric2F1[1, 1 + n, 2 + n, (a + b*Cot[c + d*x])/(a - Sqrt[-b^2])]
)/(Sqrt[-b^2]*(a - Sqrt[-b^2])*d*(1 + n)) + (b*(a + b*Cot[c + d*x])^(1 + n)*Hypergeometric2F1[1, 1 + n, 2 + n,
 (a + b*Cot[c + d*x])/(a + Sqrt[-b^2])])/(2*Sqrt[-b^2]*(a + Sqrt[-b^2])*d*(1 + n))

Rule 70

Int[((a_) + (b_.)*(x_))^(m_)*((c_) + (d_.)*(x_))^(n_), x_Symbol] :> Simp[(b*c - a*d)^n*((a + b*x)^(m + 1)/(b^(
n + 1)*(m + 1)))*Hypergeometric2F1[-n, m + 1, m + 2, (-d)*((a + b*x)/(b*c - a*d))], x] /; FreeQ[{a, b, c, d, m
}, x] && NeQ[b*c - a*d, 0] &&  !IntegerQ[m] && IntegerQ[n]

Rule 726

Int[((d_) + (e_.)*(x_))^(m_)/((a_) + (c_.)*(x_)^2), x_Symbol] :> Int[ExpandIntegrand[(d + e*x)^m, 1/(a + c*x^2
), x], x] /; FreeQ[{a, c, d, e, m}, x] && NeQ[c*d^2 + a*e^2, 0] &&  !IntegerQ[m]

Rule 3566

Int[((a_) + (b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Dist[b/d, Subst[Int[(a + x)^n/(b^2 + x^2), x], x
, b*Tan[c + d*x]], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[a^2 + b^2, 0]

Rubi steps

\begin {align*} \int (a+b \cot (c+d x))^n \, dx &=-\frac {b \text {Subst}\left (\int \frac {(a+x)^n}{b^2+x^2} \, dx,x,b \cot (c+d x)\right )}{d}\\ &=-\frac {b \text {Subst}\left (\int \left (\frac {\sqrt {-b^2} (a+x)^n}{2 b^2 \left (\sqrt {-b^2}-x\right )}+\frac {\sqrt {-b^2} (a+x)^n}{2 b^2 \left (\sqrt {-b^2}+x\right )}\right ) \, dx,x,b \cot (c+d x)\right )}{d}\\ &=\frac {b \text {Subst}\left (\int \frac {(a+x)^n}{\sqrt {-b^2}-x} \, dx,x,b \cot (c+d x)\right )}{2 \sqrt {-b^2} d}+\frac {b \text {Subst}\left (\int \frac {(a+x)^n}{\sqrt {-b^2}+x} \, dx,x,b \cot (c+d x)\right )}{2 \sqrt {-b^2} d}\\ &=-\frac {b (a+b \cot (c+d x))^{1+n} \, _2F_1\left (1,1+n;2+n;\frac {a+b \cot (c+d x)}{a-\sqrt {-b^2}}\right )}{2 \sqrt {-b^2} \left (a-\sqrt {-b^2}\right ) d (1+n)}+\frac {b (a+b \cot (c+d x))^{1+n} \, _2F_1\left (1,1+n;2+n;\frac {a+b \cot (c+d x)}{a+\sqrt {-b^2}}\right )}{2 \sqrt {-b^2} \left (a+\sqrt {-b^2}\right ) d (1+n)}\\ \end {align*}

________________________________________________________________________________________

Mathematica [C] Result contains complex when optimal does not.
time = 0.33, size = 118, normalized size = 0.71 \begin {gather*} \frac {(a+b \cot (c+d x))^{1+n} \left ((a+i b) \, _2F_1\left (1,1+n;2+n;\frac {a+b \cot (c+d x)}{a-i b}\right )-(a-i b) \, _2F_1\left (1,1+n;2+n;\frac {a+b \cot (c+d x)}{a+i b}\right )\right )}{2 (a-i b) (-i a+b) d (1+n)} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(a + b*Cot[c + d*x])^n,x]

[Out]

((a + b*Cot[c + d*x])^(1 + n)*((a + I*b)*Hypergeometric2F1[1, 1 + n, 2 + n, (a + b*Cot[c + d*x])/(a - I*b)] -
(a - I*b)*Hypergeometric2F1[1, 1 + n, 2 + n, (a + b*Cot[c + d*x])/(a + I*b)]))/(2*(a - I*b)*((-I)*a + b)*d*(1
+ n))

________________________________________________________________________________________

Maple [F]
time = 0.54, size = 0, normalized size = 0.00 \[\int \left (a +b \cot \left (d x +c \right )\right )^{n}\, dx\]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+b*cot(d*x+c))^n,x)

[Out]

int((a+b*cot(d*x+c))^n,x)

________________________________________________________________________________________

Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*cot(d*x+c))^n,x, algorithm="maxima")

[Out]

integrate((b*cot(d*x + c) + a)^n, x)

________________________________________________________________________________________

Fricas [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*cot(d*x+c))^n,x, algorithm="fricas")

[Out]

integral((b*cot(d*x + c) + a)^n, x)

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (a + b \cot {\left (c + d x \right )}\right )^{n}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*cot(d*x+c))**n,x)

[Out]

Integral((a + b*cot(c + d*x))**n, x)

________________________________________________________________________________________

Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*cot(d*x+c))^n,x, algorithm="giac")

[Out]

integrate((b*cot(d*x + c) + a)^n, x)

________________________________________________________________________________________

Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int {\left (a+b\,\mathrm {cot}\left (c+d\,x\right )\right )}^n \,d x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a + b*cot(c + d*x))^n,x)

[Out]

int((a + b*cot(c + d*x))^n, x)

________________________________________________________________________________________